from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        CREATE TABLE IF NOT EXISTS "user" (
    "uid" VARCHAR(50) NOT NULL  PRIMARY KEY,
    "username" VARCHAR(50) NOT NULL,
    "password" VARCHAR(50) NOT NULL
);
CREATE TABLE IF NOT EXISTS "live_data" (
    "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
    "room_id" VARCHAR(50) NOT NULL  /* 直播房间号 */,
    "nickName" VARCHAR(50) NOT NULL,
    "user_id" VARCHAR(200) NOT NULL,
    "keyword" TEXT NOT NULL,
    "message" TEXT NOT NULL,
    "ai_evaluation" VARCHAR(50) NOT NULL
);
CREATE TABLE IF NOT EXISTS "aerich" (
    "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
    "version" VARCHAR(255) NOT NULL,
    "app" VARCHAR(100) NOT NULL,
    "content" JSON NOT NULL
);"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        """
